#include "Strategy.h"

void Outback()
{
      
      while (isConfine_Gray())
      {
            uint8_t attitude = isConfine_Gray();                  //读取目前是否出界
            uint8_t resolve;                                      //出界状态分解
                
            for (int i = 0; i < 4; i++)
            {     
                  uint8_t amend_flag = 0;                         //修正标志
                  
                  resolve = attitude & (1 << (4 - i - 1));                    //将出界状态分解为四大类

                  switch (resolve)
                  {
                  case b_out:
                        b_outback();
                        amend_flag = 1;
                        break;
                        
                  case f_out:
                        f_outback();
                        amend_flag = 1;
                        break;
                  
                  case l_out:
                        l_outback();
                        amend_flag = 1;
                        break;
                        
                  case r_out:
                        r_outback();
                        amend_flag = 1;
                        break;
                        
                  default:
                        break;
                  }
 
                 if( 1==amend_flag ) break;
                 
            }
      }
      Forward(MIDSPEED);
}
